def getFScore(trueValue,preValue):
    '''

    :param trueValue:
    :param preValue:
    :return:
    '''
    TP=0
    FP=0
    FN=0
    TN=0
    length=trueValue.__len__()
    for i in range(length):

        if trueValue[i]==1 and preValue[i]==1:
            TP+=1
        if trueValue[i]==-1 and preValue[i]==1:
            FP+=1
        if trueValue[i]==1 and preValue[i]==-1:
            FN+=1
        if trueValue[i]==-1 and preValue[i]==-1:
            TN+=1
    print("真实\\预测\tTrue\tFalse")
    print("True     \t{}\t{}".format(TP,FN))
    print("False    \t{}\t{}".format(FP,TN))

#    accuracy=TP/(TP+FP)
#    recall=TP/(TP+FN)
#    F=2*accuracy*recall/(accuracy+recall)
    a=(TP+TN)/(TP+TN+FP+FN)
    return a

